﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace dotUML.Core.Common
{
    /// <summary>
    /// An interface allowing to create and modify the model of the UML diagram
    /// </summary>
    public interface IModel
    {
        /// <summary>
        /// List of validation errors.
        /// </summary>
        List<IError> Errors
        {
            get;
            set;
        }

        /// <summary>
        /// Create a stereotype and add it to the model.
        /// Throws an error if a stereotype with the provided name already exists.
        /// </summary>
        /// <param name="Name">Stereotype name.</param>
        /// <returns>Newly created stereotype.</returns>
        IStereotype AddStereotype(string Name);
        /// <summary>
        /// Get a stereotype.
        /// </summary>
        /// <param name="Name">Stereotype name.</param>
        /// <returns>Required stereotype or null, if it does not exist.</returns>
        IStereotype GetStereotype(string Name);
        /// <summary>
        /// Delete a stereotype. If required stereotype does not exist, does nothing.
        /// </summary>
        /// <param name="Name">Stereotype name.</param>
        void DeleteStereotype(string Name);
        /// <summary>
        /// Collection of stereotypes names.
        /// </summary>
        ICollection<string> StereotypeNames
        {
            get;
        }

        /// <summary>
        /// Create a sequence diagram and add it to the model.
        /// Throws an error if a sequence diagram with the provided name already exists.
        /// </summary>
        /// <param name="Name">Sequence diagram name.</param>
        /// <returns>Newly created sequence diagram.</returns>
        ISequenceDiagram AddSequenceDiagram(string Name);
        /// <summary>
        /// Get a sequence diagram.
        /// </summary>
        /// <param name="Name">Sequence diagram name.</param>
        /// <returns>Required sequence diagram or null, if it does not exist.</returns>
        ISequenceDiagram GetSequenceDiagram(string Name);
        /// <summary>
        /// Delete a sequence diagram. If required sequence diagram does not exist, does nothing.
        /// </summary>
        /// <param name="Name">Sequence diagram name.</param>
        void DeleteSequenceDiagram(string Name);
        /// <summary>
        /// Collection of sequence diagrams names.
        /// </summary>
        ICollection<string> SequenceDiagramNames
        {
            get;
        }

        /// <summary>
        /// Create a component diagram and add it to the model.
        /// Throws an error if a component diagram with the provided name already exists.
        /// </summary>
        /// <param name="Name">Component diagram name.</param>
        /// <returns>Newly created component diagram.</returns>
        IComponentDiagram AddComponentDiagram(string Name);
        /// <summary>
        /// Get a component diagram.
        /// </summary>
        /// <param name="Name">Component diagram name.</param>
        /// <returns>Required component diagram or null, if it does not exist.</returns>
        IComponentDiagram GetComponentDiagram(string Name);
        /// <summary>
        /// Delete a component diagram. If required component diagram does not exist, does nothing.
        /// </summary>
        /// <param name="Name">Component diagram name.</param>
        void DeleteComponentDiagram(string Name);
        /// <summary>
        /// Collection of component diagrams names.
        /// </summary>
        ICollection<string> ComponentDiagramNames
        {
            get;
        }

        /// <summary>
        /// Validate the correctness of the model.
        /// Puts the validation errors to the Errors field.
        /// </summary>
        /// <returns>True if the validation is successful, otherwise false.</returns>
        bool Validate();

    }
}
